<!DOCTYPE html>
<html lang="en">
  <head>
    <title>DecisionTree Class Reference</title>
    <link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
    <link rel="stylesheet" type="text/css" href="../css/highlight.css" />
    <meta charset='utf-8'>
    <script src="../js/jquery.min.js" defer></script>
    <script src="../js/jazzy.js" defer></script>
    
  </head>
  <body>
    <a name="//apple_ref/swift/Class/DecisionTree" class="dashAnchor"></a>
    <a title="DecisionTree Class Reference"></a>
    <header>
      <div class="content-wrapper">
        <p><a href="../index.html">AIDevLog Docs</a> (61% documented)</p>
      </div>
    </header>
    <div class="content-wrapper">
      <p id="breadcrumbs">
        <a href="../index.html">AIDevLog Reference</a>
        <img id="carat" src="../img/carat.png" />
        DecisionTree Class Reference
      </p>
    </div>
    <div class="content-wrapper">
      <nav class="sidebar">
        <ul class="nav-groups">
          <li class="nav-group-name">
            <a href="../Classes.html">Classes</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a href="../Classes/BaseEstimator.html">BaseEstimator</a>
              </li>
              <li class="nav-group-task">
                <a href="../Classes/DecisionTree.html">DecisionTree</a>
              </li>
              <li class="nav-group-task">
                <a href="../Classes/KMeans.html">KMeans</a>
              </li>
              <li class="nav-group-task">
                <a href="../Classes/KNN.html">KNN</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a href="../Extensions.html">Extensions</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a href="../Extensions/Array.html">Array</a>
              </li>
              <li class="nav-group-task">
                <a href="../Extensions/CGPoint.html">CGPoint</a>
              </li>
              <li class="nav-group-task">
                <a href="../Extensions/SCNVector3.html">SCNVector3</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a href="../Functions.html">Functions</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a href="../Functions.html#/s:8AIDevLog1poiySaySdGAC_ACtF">+(_:_:)</a>
              </li>
              <li class="nav-group-task">
                <a href="../Functions.html#/s:8AIDevLog1poiySo10SCNVector3VAD_ADtF">+(_:_:)</a>
              </li>
              <li class="nav-group-task">
                <a href="../Functions.html#/s:8AIDevLog1poiySo7CGPointVAD_ADtF">+(_:_:)</a>
              </li>
              <li class="nav-group-task">
                <a href="../Functions.html#/s:8AIDevLog1doiySaySdGAC_SdtF">/(_:_:)</a>
              </li>
              <li class="nav-group-task">
                <a href="../Functions.html#/s:8AIDevLog1doiySo10SCNVector3VAD_SdtF">/(_:_:)</a>
              </li>
              <li class="nav-group-task">
                <a href="../Functions.html#/s:8AIDevLog1doiySo7CGPointVAD_SdtF">/(_:_:)</a>
              </li>
              <li class="nav-group-task">
                <a href="../Functions.html#/s:8AIDevLog13pickerSamples_1kSayxGAD_SitlF">pickerSamples(_:k:)</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a href="../Protocols.html">Protocols</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a href="../Protocols/ClassifierMixin.html">ClassifierMixin</a>
              </li>
              <li class="nav-group-task">
                <a href="../Protocols/FeatureProtocol.html">FeatureProtocol</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a href="../Structs.html">Structures</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a href="../Structs/Distance.html">Distance</a>
              </li>
              <li class="nav-group-task">
                <a href="../Structs/Point.html">Point</a>
              </li>
            </ul>
          </li>
        </ul>
      </nav>
      <article class="main-content">
        <section>
          <section class="section">
            <h1>DecisionTree</h1>
              <div class="declaration">
                <div class="language">
                  <pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">class</span> <span class="kt">DecisionTree</span><span class="o">&lt;</span><span class="kt">Value</span><span class="p">,</span> <span class="kt">Label</span><span class="o">&gt;</span> <span class="k">where</span> <span class="kt">Value</span> <span class="p">:</span> <span class="kt">Hashable</span><span class="p">,</span> <span class="kt">Label</span> <span class="p">:</span> <span class="kt">Hashable</span></code></pre>

                </div>
              </div>
            <p>Undocumented</p>

          </section>
          <section class="section task-group-section">
            <div class="task-group">
              <ul>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:8AIDevLog12DecisionTreeC7Featurea"></a>
                    <a name="//apple_ref/swift/Alias/Feature" class="dashAnchor"></a>
                    <a class="token" href="#/s:8AIDevLog12DecisionTreeC7Featurea">Feature</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Undocumented</p>

                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">typealias</span> <span class="kt">Feature</span> <span class="o">=</span> <span class="p">[</span><span class="kt">Value</span><span class="p">]</span></code></pre>

                        </div>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:8AIDevLog12DecisionTreeC1X33_892AB82079AFB64289C0CE5454D51354LLSaySayxGGvp"></a>
                    <a name="//apple_ref/swift/Property/X" class="dashAnchor"></a>
                    <a class="token" href="#/s:8AIDevLog12DecisionTreeC1X33_892AB82079AFB64289C0CE5454D51354LLSaySayxGGvp">X</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Data set</p>

                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">private</span> <span class="k">var</span> <span class="nv">X</span><span class="p">:</span> <span class="p">[[</span><span class="kt">Value</span><span class="p">]]</span></code></pre>

                        </div>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:8AIDevLog12DecisionTreeC1y33_892AB82079AFB64289C0CE5454D51354LLSayq_Gvp"></a>
                    <a name="//apple_ref/swift/Property/y" class="dashAnchor"></a>
                    <a class="token" href="#/s:8AIDevLog12DecisionTreeC1y33_892AB82079AFB64289C0CE5454D51354LLSayq_Gvp">y</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Target values</p>

                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">private</span> <span class="k">var</span> <span class="nv">y</span><span class="p">:</span> <span class="p">[</span><span class="kt">Label</span><span class="p">]</span></code></pre>

                        </div>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:8AIDevLog12DecisionTreeC3fit1X1yySaySayxGG_Sayq_GtF"></a>
                    <a name="//apple_ref/swift/Method/fit(X:y:)" class="dashAnchor"></a>
                    <a class="token" href="#/s:8AIDevLog12DecisionTreeC3fit1X1yySaySayxGG_Sayq_GtF">fit(X:y:)</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Undocumented</p>

                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">fit</span><span class="p">(</span><span class="kt"><a href="../Classes/DecisionTree.html#/s:8AIDevLog12DecisionTreeC1X33_892AB82079AFB64289C0CE5454D51354LLSaySayxGGvp">X</a></span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Classes/DecisionTree.html#/s:8AIDevLog12DecisionTreeC7Featurea">Feature</a></span><span class="p">],</span> <span class="nv">y</span><span class="p">:</span> <span class="p">[</span><span class="kt">Label</span><span class="p">])</span></code></pre>

                        </div>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:8AIDevLog12DecisionTreeC7predict1XySaySayxGG_tF"></a>
                    <a name="//apple_ref/swift/Method/predict(X:)" class="dashAnchor"></a>
                    <a class="token" href="#/s:8AIDevLog12DecisionTreeC7predict1XySaySayxGG_tF">predict(X:)</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Undocumented</p>

                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">predict</span><span class="p">(</span><span class="kt"><a href="../Classes/DecisionTree.html#/s:8AIDevLog12DecisionTreeC1X33_892AB82079AFB64289C0CE5454D51354LLSaySayxGGvp">X</a></span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Classes/DecisionTree.html#/s:8AIDevLog12DecisionTreeC7Featurea">Feature</a></span><span class="p">])</span></code></pre>

                        </div>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:8AIDevLog12DecisionTreeC14calcShannonEnt7dataSetSdSaySayxGG_tF"></a>
                    <a name="//apple_ref/swift/Method/calcShannonEnt(dataSet:)" class="dashAnchor"></a>
                    <a class="token" href="#/s:8AIDevLog12DecisionTreeC14calcShannonEnt7dataSetSdSaySayxGG_tF">calcShannonEnt(dataSet:)</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Undocumented</p>

                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">calcShannonEnt</span><span class="p">(</span><span class="nv">dataSet</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Classes/DecisionTree.html#/s:8AIDevLog12DecisionTreeC7Featurea">Feature</a></span><span class="p">])</span> <span class="o">-&gt;</span> <span class="kt">Double</span></code></pre>

                        </div>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:8AIDevLog12DecisionTreeC12splitDataSet04dataG03col5valueSaySayxGGAI_SixtF"></a>
                    <a name="//apple_ref/swift/Method/splitDataSet(dataSet:col:value:)" class="dashAnchor"></a>
                    <a class="token" href="#/s:8AIDevLog12DecisionTreeC12splitDataSet04dataG03col5valueSaySayxGGAI_SixtF">splitDataSet(dataSet:col:value:)</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Undocumented</p>

                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">splitDataSet</span><span class="p">(</span><span class="nv">dataSet</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Classes/DecisionTree.html#/s:8AIDevLog12DecisionTreeC7Featurea">Feature</a></span><span class="p">],</span> <span class="nv">col</span><span class="p">:</span> <span class="kt">Int</span><span class="p">,</span> <span class="nv">value</span><span class="p">:</span> <span class="kt">Value</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="p">[</span><span class="kt"><a href="../Classes/DecisionTree.html#/s:8AIDevLog12DecisionTreeC7Featurea">Feature</a></span><span class="p">]</span></code></pre>

                        </div>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:8AIDevLog12DecisionTreeC24chooseBestFeatureToSplit7dataSetSiSaySayxGG_tF"></a>
                    <a name="//apple_ref/swift/Method/chooseBestFeatureToSplit(dataSet:)" class="dashAnchor"></a>
                    <a class="token" href="#/s:8AIDevLog12DecisionTreeC24chooseBestFeatureToSplit7dataSetSiSaySayxGG_tF">chooseBestFeatureToSplit(dataSet:)</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Undocumented</p>

                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">chooseBestFeatureToSplit</span><span class="p">(</span><span class="nv">dataSet</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Classes/DecisionTree.html#/s:8AIDevLog12DecisionTreeC7Featurea">Feature</a></span><span class="p">])</span> <span class="o">-&gt;</span> <span class="kt">Int</span></code></pre>

                        </div>
                      </div>
                    </section>
                  </div>
                </li>
              </ul>
            </div>
          </section>
        </section>
        <section id="footer">
          <p>&copy; 2019 <a class="link" href="http://iosdevlog.com" target="_blank" rel="external">iOSDevLog</a>. All rights reserved. (Last updated: 2019-08-13)</p>
          <p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
        </section>
      </article>
    </div>
  </body>
</div>
</html>
